package com.lv.phuotbacnam.ui.activity;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.os.Bundle;
import android.util.Base64;

import com.lv.phuotbacnam.R;
import com.lv.phuotbacnam.bl.log.Logger;
import com.lv.phuotbacnam.ui.fragment.SplashFragment;

public class SplashActivity extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);

		// getKeyhash();

		if (savedInstanceState == null) {
			navigateTo(SplashFragment.class, null, null, false);
		}

	}

	public void getKeyhash() {
		// Add code to print out the key hash
		try {
			PackageInfo info = getPackageManager().getPackageInfo(
					"com.lv.phuotbacnam", PackageManager.GET_SIGNATURES);
			for (Signature signature : info.signatures) {
				MessageDigest md = MessageDigest.getInstance("SHA");
				md.update(signature.toByteArray());
				Logger.logMessage("key: "
						+ Base64.encodeToString(md.digest(), Base64.DEFAULT));
			}
		} catch (NameNotFoundException e) {

		} catch (NoSuchAlgorithmException e) {

		}
	}

	@Override
	protected int getContainerId() {
		return R.id.container;
	}

}
